package com.zhijian.medical.entity.vo.response;

import com.zhijian.medical.util.StrUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * 荧光PCR-结果明细 回显vo
 *
 * @author HCG
 * @version 1.0
 * @date 2022-08-30 15:35:52
 */
@Data
@Api(tags = "荧光PCR-结果明细回显vo")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PcrResultDetailVo implements Serializable, Comparable<PcrResultDetailVo> {

    private static final long serialVersionUID = -1;

    /**
     * 主键id
     */
    @ApiModelProperty("主键id")
    private Long id;

    /**
     * 实验流程id
     */
    @ApiModelProperty("实验流程id")
    private Long pcrId;

    /**
     * 设备id
     */
    @ApiModelProperty("设备id")
    private Long deviceId;

    /**
     * 结果id
     */
    @ApiModelProperty("结果id")
    private Long resultId;

    /**
     * 扩增仪数据id
     */
    @ApiModelProperty("扩增仪数据id")
    private Long pcrKzyId;

    /**
     * 反应孔
     */
    @ApiModelProperty("反应孔")
    private String fyk;

    /**
     * 突变类型
     */
    @ApiModelProperty("突变类型")
    private String tblx;

    /**
     * 内控CT
     */
    @ApiModelProperty("内控CT")
    private BigDecimal nkct;

    /**
     * 外控CT
     */
    @ApiModelProperty("外控CT")
    private BigDecimal wkct;

    /**
     * 突变CT值
     */
    @ApiModelProperty("突变CT值")
    private BigDecimal tbct;

    /**
     * 德尔塔CT值
     */
    @ApiModelProperty("德尔塔CT值")
    private BigDecimal ct3;

    /**
     * 阴阳性
     */
    @ApiModelProperty("阴阳性")
    private String yyx;

    /**
     * 扩增曲线图片地址
     */
    @ApiModelProperty("扩增曲线图片地址")
    private String kzLineFilePath;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    private String createTime;

    /**
     * 修改时间
     */
    @ApiModelProperty("修改时间")
    private String updateTime;

    @Override
    public int compareTo(PcrResultDetailVo o) {
        if (Objects.isNull(o) || StringUtils.isBlank(o.getFyk())) {
            return -1;
        }
        String thisFyk = this.getFyk();
        String otherFyk = o.getFyk();
        //先比较字母
        String thisLetter = thisFyk.substring(0, 1);
        String otherLetter = otherFyk.substring(0, 1);
        if (thisLetter.equals(otherLetter)) {
            //字母相同比较数字
            return StrUtil.drawNumberFromStr(thisFyk).compareTo(StrUtil.drawNumberFromStr(otherFyk));
        } else {
            return thisLetter.compareTo(otherLetter);
        }
    }

}